package com.example.fms.enums;

/**
 * 范围
 */
public enum ExtentEnum {
    GREATER_THAN("0", ">"),
    GREATER_THAN_OR_EQUAL_TO("1", ">="),
    LESS_THAN("2", "<"),
    LESS_THAN_OR_EQUAL_TO("3", "<=");

    private  String code;
    private  String name;

    public static String getNameByCode(String code) {
        for (ExtentEnum value : ExtentEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return null;
    }

    //根据name查Code
    public static String getCodeByName(String name) {
        for (ExtentEnum value : ExtentEnum.values()) {
            if (value.getName().equals(name)) {
                return value.getCode();
            }
        }
        return null;
    }

    ExtentEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
